<?php
// application/middleware/TransformPath.php
namespace app\middleware;

class TransformPath
{
    public function handle($request, \Closure $next)
    {
        // 获取原始请求路径
        $path = $request->path();

        // 将路径中的 "-" 替换为驼峰命名
        $path = str_replace('-', '', ucwords($path, '-'));

        // 更新请求的路径
        $request->setPathinfo($path);

        return $next($request);
    }
}